call plug#begin('/home/kusaeni/.config/nvim/addons')

" Tools
    Plug 'junegunn/goyo.vim'
    Plug 'vifm/vifm.vim'
    Plug 'junegunn/limelight.vim'
    "Plug 'neoclide/coc.nvim', {'branch': 'release'}
    Plug 'ctrlpvim/ctrlp.vim'
    Plug 'tpope/vim-fugitive'
    Plug 'tpope/vim-sensible'
    Plug 'tpope/vim-surround'
    Plug 'ervandew/supertab'
    Plug 'ervandew/supertab'
    Plug 'jiangmiao/auto-pairs'
    Plug 'junegunn/vim-easy-align'
    Plug 'alvan/vim-closetag'
    Plug 'sheerun/vim-polyglot'
    Plug 'mattn/emmet-vim'
    Plug 'dense-analysis/ale'
    Plug 'junegunn/fzf', { 'do': { -> fzf#install()  }  }
    Plug 'junegunn/fzf.vim'
    Plug 'airblade/vim-gitgutter'
    Plug 'tpope/vim-eunuch'
    Plug 'preservim/nerdcommenter'
    Plug 'othree/yajs.vim'
    Plug 'othree/html5.vim'
    Plug 'HerringtonDarkholme/yats.vim'
" dekorasi
    Plug 'preservim/nerdtree'
    Plug 'Xuyuanp/nerdtree-git-plugin'
    Plug 'ryanoasis/vim-devicons'
    Plug 'Yggdroot/indentLine'
    Plug 'junegunn/rainbow_parentheses.vim'
    Plug 'chrisbra/Colorizer'
    Plug 'KabbAmine/vCoolor.vim'
    Plug 'sonph/onehalf', { 'rtp': 'vim'  }
    Plug 'junegunn/vim-journal'
    Plug 'dracula/vim', { 'as': 'dracula'  }
    Plug 'itchyny/lightline.vim'
    Plug 'junegunn/seoul256.vim'
    "Plug 'ayu-theme/ayu-vim'
    Plug 'kuntau/ayu-vim'
    Plug 'arcticicestudio/nord-vim'
    Plug 'drewtempelmeyer/palenight.vim'
    Plug 'rakr/vim-one'
    Plug 'mhartington/oceanic-next'
    
" Syntax
    Plug 'godlygeek/tabular' | Plug 'plasticboy/vim-markdown'
    Plug 'ap/vim-css-color' "Displays a preview of colors with CSS 
    "Plug 'vim-scripts/fountain.vim'

  if has('nvim')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins'  }
    Plug 'deoplete-plugins/deoplete-jedi'
  else
    Plug 'Shougo/deoplete.nvim'
    Plug 'roxma/nvim-yarp'
    Plug 'roxma/vim-hug-neovim-rpc'
  endif
    let g:deoplete#enable_at_startup = 1

" Color-schemes
    "Plug 'morhetz/gruvbox' "My favorite theme
    "Plug 'kristijanhusak/vim-hybrid-material'
    "Plug 'NLKNguyen/papercolor-theme'
    "Plug 'ajh17/Spacegray.vim'
    "Plug 'chriskempson/base16-vim'
call plug#end() 

" Umum
set encoding=UTF-8
filetype plugin indent on
syntax on
set autoread wildmode=longest,list,full
"set spell spelllang=en_us
set backspace=indent,eol,start confirm
set shiftwidth=4 autoindent smartindent tabstop=4 softtabstop=4 expandtab smarttab autoindent
set list listchars=tab:»-
"set fillchars+=vert:\ 
"set wrap breakindent
"set list listchars=tab:▒░,trail:▓,nbsp:░
"set showbreak=↪
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
set hls is ic
set laststatus=2 cmdheight=1
au BufRead,BufNewFile *.fountain set filetype=fountain
set splitbelow splitright 
set nobackup nowritebackup
set number
set numberwidth=2
set tw=109
set t_Co=256
set cursorline
autocmd ColorScheme * highlight CursorLineNr cterm=bold term=bold gui=bold

"Status-line
set statusline=
set statusline+=%#IncSearch#
set statusline+=\ %y
set statusline+=\ %r
set statusline+=%#CursorLineNr#
set statusline+=\ %F
set statusline+=%= "Right side settings
set statusline+=%#Search#
set statusline+=\ %l/%L
set statusline+=\ [%c]

" Indent
let g:indentLine_char = '⫶'
let g:indentLine_first_char = '⫶'
let g:indentLine_showFirstIndentLevel = 1
let g:indentLine_setColors = 1


" Ale
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'

" autocmd
autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType css setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType xml setlocal shiftwidth=2 tabstop=2 softtabstop=240
autocmd FileType markdown setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType markdown let g:vim_markdown_conceal = 0
autocmd FileType markdown normal zR
let g:vim_markdown_frontmatter = 1
autocmd FileType journal setlocal shiftwidth=2 tabstop=2 softtabstop=2 

augroup rainbow_lisp
  autocmd!
    autocmd FileType lisp,clojure,scheme RainbowParentheses
augroup END

let g:rainbow#max_level = 16
let g:rainbow#pairs = [['(', ')'], ['[', ']']]
let g:rainbow#blacklist = [233, 234]

"
let g:NERDCreateDefaultMappings = 1
let g:NERDSpaceDelims = 1
let g:NERDCompactSexyComs = 1
let g:NERDCommentEmptyLines = 1
let g:NERDTrimTrailingWhitespace = 1
let g:NERDToggleCheckAllLines = 1
let g:NERDTreeShowHidden=1

"Key-bindings
let mapleader=","
nmap <leader>q :NERDTreeToggle<CR>
nmap \ <leader>q
nnoremap <leader>n :Explore<CR>
nnoremap <leader><Space> :CtrlP<CR>
nnoremap <leader><ENTER> :Goyo<CR>
nnoremap <leader>, :vsplit ~/.config/nvim/init.vim<CR>
nnoremap <leader>g :GitGutterDisable <BAR> :set laststatus=0 <CR>
nnoremap <C-g> :set spelllang=ID_id<CR>
"nnoremap <C-l> :set background=light<CR>
nnoremap <C-s> :source ~/.config/nvim/init.vim<CR>
nmap <leader>j :set filetype=journal<CR>

"nnoremap <Up> :resize +2<CR> 
"nnoremap <Down> :resize -2<CR>
"nnoremap <Left> :vertical resize +2<CR>
"nnoremap <Right> :vertical resize -2<CR>

xnoremap K :move '<-2<CR>gv-gv
xnoremap J :move '>+1<CR>gv-gv

nnoremap Q <nop>

nnoremap <leader>h <C-W>h
nnoremap <leader>j <C-W>j
nnoremap <leader>k <C-W>k
nnoremap <leader>l <C-W>l

" colorscheme
set termguicolors
"set background=dark
"let ayucolor="light"
let ayucolor="mirage"
"let ayucolor="dark""
"let g:one_allow_italics=1
"let g:oceanic_next_terminal_bold = 1
"let g:oceanic_next_terminal_italic = 1
colorscheme ayu

hi! Normal ctermbg=NONE guibg=NONE 
hi! NonText ctermbg=NONE guibg=NONE guifg=NONE ctermfg=NONE 

let g:limelight_conceal_ctermfg = 'gray'
let g:limelight_conceal_ctermfg = 240
let g:limelight_conceal_guifg = 'DarkGray'
let g:limelight_conceal_guifg = '#777777'

" lightline
"let g:lightline = { 'colorscheme': 'seoul256'}

"Goyo settings

function! s:goyo_enter()
    set noshowmode
    set noshowcmd
    set nocursorline
    "CocDisable
    Limelight
endfunction

function! s:goyo_leave()
    set showmode
    set showcmd
    set cursorline
    "CocEnable
    Limelight!
endfunction

autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave() 

nmap <Tab> :bnext<CR>
nmap <S-Tab> :bprevious<CR>
nmap <leader>h :RainbowParentheses!!<CR>

"italic
highlight Comment cterm=italic
set t_ZH=^[[3m
set t_ZR=^[[23m
